import request from '@/utils/request.js'

export const getArticleDetailAPI = (artid) => {
  return request.get(`/v1_0/articles/${artid}`)
}
// 关注作者的api
export const followUserAPI = userid => {
  return request.post('/v1_0/user/followings', {
    target: userid
  })
}
// 取消关注的接口
export const unfollowUserAPI = uautid => {
  return request.delete(`/v1_0/user/followings/${uautid}`)
}
// 点赞api
export const addlikeAPI = artid => {
  return request.post('/v1_0/article/likings', {
    target: artid
  })
}
// 取消点赞
export const cancellikeAPI = artid => {
  return request.delete(`/v1_0/article/likings/${artid}`)
}
// 文章评论列表
export const artCommentAPI = (artid, offset) => {
  return request.get('/v1_0/comments', {
    params: {
      type: 'a',
      source: artid,
      offset
    }
  })
}
// 评论点赞API
export const addLikeCmtAPI = cmtId => {
  return request.post('/v1_0/comment/likings', {
    target: cmtId
  })
}
// 取消评论点赞
export const cancelLikeCmtAPI = cmt => {
  return request.delete(`/v1_0/comment/likings/${cmt}`)
}
// 发表评论
export const pubCommentAPI = (artid, content) => {
  return request.post('/v1_0/comments', {
    target: artid,
    content
  })
}
